package com.shankungfu.util;

import com.loopj.android.http.AsyncHttpResponseHandler;

public abstract class MyAsyncHttpResponseHandler extends AsyncHttpResponseHandler {

	private boolean showNotNetToast = true;

	public boolean isShowNotNetToast() {
		return showNotNetToast;
	}

	public void setShowNotNetToast(boolean showNotNetToast) {
		this.showNotNetToast = showNotNetToast;
	}

	@Override
	public void onSuccess(int statusCode, String content) {
		TestUtils.logI("获取成功的  statusCode:" + statusCode + ", content:"
				+ content);
		onSuccess(content);
	}
	
	@Override
	public void onFailure(Throwable error, String content) {
		ToastUtil.loadDataFailure(isShowNotNetToast());
		TestUtils.logI("获取失败的 error:" + error + ", content:" + content);
		onFailure(content);
	}
	
	public abstract void onSuccess(String content);
	public abstract void onFailure(String content);
}
